import next from 'next';
import { createServer } from '@/server/app';

const prod = process.env.NODE_ENV === 'production';

if (prod) {
    const app = next({ dev: !prod });
    const handle = app.getRequestHandler();

    app.prepare().then(() => createServer({nextHandler: handle}));
} else {
    createServer();
}